package com.yaozheng.vocationaltraining.dialog.userinfo;

import android.content.Context;
import android.view.Gravity;

import com.yaozheng.vocationaltraining.R;
import com.yaozheng.vocationaltraining.dialog.BaseDialog;
import com.yaozheng.vocationaltraining.fragment.BaseFragment;
import com.yaozheng.vocationaltraining.view.userinfo.SelectSaxDialogView;
import com.yaozheng.vocationaltraining.view.userinfo.SelectSaxDialogView_;

/**
 * 性别对话框
 */
public class SaxDialog extends BaseDialog {
    SelectSaxDialogView selectSaxView;
    String manRunMethod;
    String allRunMethod;
    BaseFragment baseFragment;


    public SaxDialog(Context context) {
        this(context, R.style.baseDialogStyleTheme, true, Gravity.BOTTOM);
    }

    public SaxDialog(BaseFragment baseFragment) {
        this(baseFragment.getContext());
        this.baseFragment = baseFragment;
    }

    public SaxDialog(Context context, int theme, boolean isCover, int gravity) {
        super(context, theme, isCover, gravity);
    }

    @Override
    public void setContentView() {
        selectSaxView = SelectSaxDialogView_.build(getContext());
        selectSaxView.setBaseDialogEventProcess(this);
        setContentView(selectSaxView);

    }


    public void setManRunMethod(String manRunMethod) {
        this.manRunMethod = manRunMethod;
    }


    public void setAllRunMethod(String allRunMethod) {
        this.allRunMethod = allRunMethod;
    }

    /**
     * 选女
     */
    public void allClick() {
        cancel();
        if (allRunMethod == null) {
            allRunMethod = "saxDialogAllClick";
        }
        if (baseFragment != null) {
            baseFragment.runMethod(allRunMethod);
        } else {
            baseActivity.runMethod(allRunMethod);
        }
    }

    /**
     * 选男
     */
    public void manClick() {
        cancel();
        if (manRunMethod == null) {
            manRunMethod = "saxDialogManClick";
        }
        if (baseFragment != null) {
            baseFragment.runMethod(manRunMethod);
        } else {
            baseActivity.runMethod(manRunMethod);
        }
    }

}
